﻿using MainService.UISERVER;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using System.Xml.Serialization;

namespace MainService
{
    public static class MyServer
    {
        static MyServer() 
        {
            XmlSerializer xs = new XmlSerializer(typeof(ServerConfig));
            string filepath = Application.StartupPath + "\\ServerConfig.xml";
            using (Stream sm = new FileStream(filepath, FileMode.Open)) 
            {
                MyServer.ServerConfig = (ServerConfig)xs.Deserialize(sm);
            }
        }
        public static MainZNQD.Solution OldCurrentSolution { get; set; }
        public static MainService.ZNQD.Solution CurrentSolution { get; set; }
        public static AppSystem CurrentAppSystem { get; set; }
        public static List<string> CurrentUrls { get; set; }
        public static List<string> CurrentUrlDescriptions { get; set; }
        public static Form CurrentUrlFrm { get; set; }
        public static string UserID = string.Empty;
        public static ServerConfig ServerConfig { get; set; }
        public static EditModel EditModel = EditModel.Template;
        public static EditType EditType = EditType.Create;
        public static void Log(string mess) 
        {
            MyLog mylog = MyLog.GetInstance();
            mylog.WriteEmailLog(mess);
        }
    }
}
